<!DOCTYPE html>












  


<html class="theme-next mist use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">


  <script>
  (function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/0f81ff2f.js","daovoice")
  daovoice('init', {
      app_id: "15fc8e87"
    });
  daovoice('update');
  </script>






  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=6.3.0" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.3.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.3.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.3.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.3.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '6.3.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="最近工作上需要一些企业的详细的数据，工商信息啦，基本信息啦，还有一些关系图(投资关系、人物图谱)之类的，然后我来负责从企查查上弄些数据。">
<meta name="keywords" content="爬虫,工作">
<meta property="og:type" content="article">
<meta property="og:title" content="Springboot与Selenium合体变蜘蛛爬企查查">
<meta property="og:url" content="http://blog.wangxc.club/2018/01/09/Springboot与Selenium合体变蜘蛛爬企查查/index.html">
<meta property="og:site_name" content="冬与晨">
<meta property="og:description" content="最近工作上需要一些企业的详细的数据，工商信息啦，基本信息啦，还有一些关系图(投资关系、人物图谱)之类的，然后我来负责从企查查上弄些数据。">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-6d1b60100f524e89.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-593429122f595860.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-3b7d2f7233e28fe9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-d0336145573c7bd8.gif?imageMogr2/auto-orient/strip">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-f319a7b45ba7e015.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-cc8fcfafaf862346.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-ce918f2060e2a870.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-803adc2481538053.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-9fe92c8c1bbeec15.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-8407637d40632dbf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/3167229-ac19fd72317d51fb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:updated_time" content="2018-06-29T13:58:50.289Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Springboot与Selenium合体变蜘蛛爬企查查">
<meta name="twitter:description" content="最近工作上需要一些企业的详细的数据，工商信息啦，基本信息啦，还有一些关系图(投资关系、人物图谱)之类的，然后我来负责从企查查上弄些数据。">
<meta name="twitter:image" content="http://upload-images.jianshu.io/upload_images/3167229-6d1b60100f524e89.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">






  <link rel="canonical" href="http://blog.wangxc.club/2018/01/09/Springboot与Selenium合体变蜘蛛爬企查查/">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>Springboot与Selenium合体变蜘蛛爬企查查 | 冬与晨</title>
  




<script async src="https://www.googletagmanager.com/gtag/js?id=UA-102769182-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-102769182-1');
</script>



  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?809d5610fca8eaff344d9a698536110d";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband">
    </div>
<a href="https://github.com/vector4wang"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">冬与晨</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-commonweal">
    <a href="/404/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>公益 404</a>
  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.wangxc.club/2018/01/09/Springboot与Selenium合体变蜘蛛爬企查查/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="wangxc">
      <meta itemprop="description" content="革命尚未成功，同志还需努力~">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="冬与晨">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">Springboot与Selenium合体变蜘蛛爬企查查
              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-01-09 23:37:31" itemprop="dateCreated datePublished" datetime="2018-01-09T23:37:31+08:00">2018-01-09</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-06-29 21:58:50" itemprop="dateModified" datetime="2018-06-29T21:58:50+08:00">2018-06-29</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/技术/" itemprop="url" rel="index"><span itemprop="name">技术</span></a></span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2018/01/09/Springboot与Selenium合体变蜘蛛爬企查查/#comments" itemprop="discussionUrl">
                  <span class="post-meta-item-text">评论数：</span> <span class="post-comments-count valine-comment-count" data-xid="/2018/01/09/Springboot与Selenium合体变蜘蛛爬企查查/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>最近工作上需要一些企业的详细的数据，工商信息啦，基本信息啦，还有一些关系图(投资关系、人物图谱)之类的，然后我来负责从企查查上弄些数据。</p>
<a id="more"></a>

<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="86" src="//music.163.com/outchain/player?type=2&id=5264841&auto=1&height=66"></iframe>


<p><em>强调：下面只是快速实现数据抓取的思路，没有详细的代码，同时也拒绝伸手党。</em></p>
<p>现实中，一些工商信息网站会被无数的爬虫“骚扰”，所以网站的反爬虫策略也是越来越高，就拿企查查来说，基本的信息是直接可访问的，但是像<strong>人物图谱</strong>和<strong>企业图谱</strong>这些内容还是需要登录的，<br>特别是人物图谱，非VIP会员，一天也只能看两次<br><a href="https://i.loli.net/2018/01/04/5a4e42384c42e.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-6d1b60100f524e89.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="3.png"></a><br>企查查的登录也是做了很多限制<br>比如图片验证码啊，数字验证码啊，还有验证码异常出现刷新按钮啊等等(之前在做的过程中发现的没有及时截图)<br><a href="https://i.loli.net/2018/01/05/5a4ed6e155c03.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-593429122f595860.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="5.png"></a><br>但是有了<code>selenium</code>这些都不是问题~接下来按照如下思维导图做一个抓取的分析(代码想了许久还是不贴出来了)<br><a href="https://i.loli.net/2018/01/08/5a538d3dbf7d4.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-3b7d2f7233e28fe9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="企查查.png"></a></p>
<h2 id="登录"><a href="#登录" class="headerlink" title="登录"></a>登录</h2><blockquote>
<p>滑块验证</p>
</blockquote>
<p>首先出场的是滑块验证，这个可以使用Selenium中的Actions.clickAndHold()来破防，打开浏览器Element面板，边滑动滑块边观察Html<br><a href="https://i.loli.net/2018/01/08/5a538faf23d68.gif" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-d0336145573c7bd8.gif?imageMogr2/auto-orient/strip" alt="1.gif"></a>这说明滑块不只是单纯的移动到右侧，还导致其他样式改变，这也说明<strong>你不能直接通过修改Html的方式改变滑块的位置来验证</strong> ，Ps:有的网站只要滑块在最终的位置，就认为验证通过了。<br>使用java和selenium模拟滑动滑块</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">WebElement dragger = driver.findElement(By.cssSelector(<span class="string">"#nc_1_n1z"</span>));</span><br><span class="line">Actions action = <span class="keyword">new</span> Actions(driver);</span><br><span class="line">action.clickAndHold(dragger).build().perform();</span><br><span class="line"><span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; target; i++) &#123;</span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        action.moveByOffset(offset, <span class="number">0</span>).perform();</span><br><span class="line">    &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line">        e.printStackTrace();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>target 和 offset 的值自己去口算一下~</p>
<blockquote>
<p>图片型验证码</p>
</blockquote>
<p>不知为何，我每次用代码模拟滑块的时候页面都会弹出图片型验证码，而人工滑动却不要，这让我很费解。<br>一般像图片型验证码和数字型验证码有的人可能会自己去研究算法来解决，什么机器学习啦，深度学习啦等等。这里不要这么高深的，统统用打码平台，用法和价格自行百度，可以这样理解：你通过Http的方式提交图片和要求，平台会返回给你相应的结果。如数字啦、文字的坐标啦、多个文字的坐标等等。<br>仔细分析下面的截图所对应的的Element<br><a href="https://i.loli.net/2018/01/05/5a4ed6e155c03.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-f319a7b45ba7e015.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="5.png"></a><br>我们可以看出验证要求在青色横条中，而目标文字在下面的方块中，这是两个不同的Element，而打码平台的要求是给他一张完整的图片，这个当时我想都没想，立即决定使用selenium截图的方式将横条和方块分别保存下来，然后通过代码将其拼接为一张图片,最后将一整张图提交给打码平台。如下<br><a href="https://i.loli.net/2018/01/09/5a541c63649ca.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-cc8fcfafaf862346.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="waitProcessImg.png"></a><br>然后平台会返回给你一个坐标如(x,y)，刚刚提到了方块图他是单独的一个Element，所以目标y还要减去横条的高度即(x,y-34),这个时候你以为搞定了？NoNoNo!通过浏览器的定位元素，可以看到<br><a href="https://i.loli.net/2018/01/09/5a541e29adf88.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-ce918f2060e2a870.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="QQ截图20180109094227.png"></a><br>方块所在的Elemnt 有个样式<code>margin-left</code>，所以我们还要减去这个值，即最终的最标为(x + 2, y - 34)为什么是2而不是10，这个是因为我尝试了很多次，发现2才可以。。。<br>好了接下来就是根据坐标去点击，要用到这个方法：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Actions action = <span class="keyword">new</span> Actions(driver);</span><br><span class="line">action.moveToElement(bodyImgEle, x + <span class="number">2</span>, y - <span class="number">34</span>).click().perform();</span><br></pre></td></tr></table></figure>

<p>这里注意下，moveToElement是以element的左上角为原点，往右是X，往下是Y</p>
<blockquote>
<p>数字验证码</p>
</blockquote>
<p>(没有截图，只有代码截的图)<br><a href="https://i.loli.net/2018/01/09/5a54d3fe304e7.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-803adc2481538053.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="微信截图_20180109223914.png"></a><br>这样的就很普通了，我们依然交给打码平台，通过使用返回的“MV9C”来通过此验证。</p>
<blockquote>
<p>异常刷新</p>
</blockquote>
<p>(这个也没有截图)出现这种情况我猜测是企查查检测到你这边频繁的登录或验证，形式就是滑动条上出现了“刷新”超链接，这个只要定为到“刷新”Element，点击一下就ok，如下</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">WebElement err = reloadElement.findElement(By.cssSelector(<span class="string">"#dom_id_one &gt; div &gt; span &gt; a"</span>));</span><br><span class="line">err.click();</span><br></pre></td></tr></table></figure>

<p><em>注意：登录的过程中每一个验证都可能有失败的情况，所以每个处理最好加上一个循环，直到验证通过再跳出循环进入下一步操作</em></p>
<h2 id="抓取数据"><a href="#抓取数据" class="headerlink" title="抓取数据"></a>抓取数据</h2><p>这里重点讲企业详情页<br>对于企查查来说只要登录这块搞定了，其他数据不是问题，就是简单的分析下每个数据的请求地址，然后用selenium模拟请求就行了。</p>
<blockquote>
<p>人物图谱</p>
</blockquote>
<p><a href="https://i.loli.net/2018/01/09/5a54d8c55b05c.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-9fe92c8c1bbeec15.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="微信截图_20180109225840.png"></a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">URL:http://www.qichacha.com/company_opercorview?name=马化腾&amp;personId=p03cf330a686332cfe9cb8f36a8f3ab8&amp;keyno=f1c5372005e04ba99175d5fd3db7b8fc</span><br></pre></td></tr></table></figure>

<blockquote>
<p>投资图谱</p>
</blockquote>
<p><a href="https://i.loli.net/2018/01/09/5a54d8c558f81.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-8407637d40632dbf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="微信截图_20180109225933.png"></a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">URL:http://www.qichacha.com/company_relation?keyNo=f1c5372005e04ba99175d5fd3db7b8fc&amp;name=深圳市腾讯计算机系统有限公司</span><br></pre></td></tr></table></figure>

<p>很直观的就能看到请求地址，然后将返回的JSON字符串处理一下，就得到了你想要的数据<br>这里不做太多的赘述。</p>
<p>贴个控制台的图<br><a href="https://i.loli.net/2018/01/09/5a54dafa3dcc6.png" target="_blank" rel="noopener"><img src="http://upload-images.jianshu.io/upload_images/3167229-ac19fd72317d51fb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="微信截图_20180109230911.png"></a></p>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>总的来讲企查查的网站相对于天眼查还是比较容易突破的，只要把登录这块完美处理好，其他就是解析上的问题了。<br>话说企查查并没有对访问IP做限制处理，只是如果用一个账号访问次数太多之后，中间也会出现滑块认证，但是不要担心，你可以把登录那块的验证逻辑直接搬过来即可，你敢信？</p>
<p><strong>爬虫不是我的主要工作，我只是对数据抓取这块比较感兴趣，还有在工作中有些数据需要抓取，所以我也就担当了半个爬虫的角色，最近自己在使用jsoup写一个简易爬虫框架(参照webmagic)，有兴趣得可持续关注我，如果有必要的话，我会写一些爬虫教程，让小白变大白(●—●)绰绰有余</strong></p>
<p>CSDN：<a href="http://blog.csdn.net/qqhjqs?viewmode=list" target="_blank" rel="noopener">http://blog.csdn.net/qqhjqs?viewmode=list</a><br>博客：<a href="http://vector4wang.tk/" target="_blank" rel="noopener">http://vector4wang.tk/</a><br>简书：<a href="https://www.jianshu.com/u/223a1314e818" target="_blank" rel="noopener">https://www.jianshu.com/u/223a1314e818</a><br>Github:<a href="https://github.com/vector4wang" target="_blank" rel="noopener">https://github.com/vector4wang</a></p>

      
    </div>

    

    
    
    

    <div>
          
            
          
    </div>

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div></div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="https://i.loli.net/2017/12/29/5a4632028eaeb.jpg" alt="wangxc 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="https://i.loli.net/2017/12/29/5a46320234b1d.jpg" alt="wangxc 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
<div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">
              -------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------
        </div>
    
</div>

  
</div>
    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/爬虫/" rel="tag"><i class="fa fa-tag"></i> 爬虫</a>
          
            <a href="/tags/工作/" rel="tag"><i class="fa fa-tag"></i> 工作</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/01/01/平静的2017，不安的2018/" rel="next" title="平静的2017，不安的2018">
                <i class="fa fa-chevron-left"></i> 平静的2017，不安的2018
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/01/11/微信短链接秒进支付宝拆红包的逆向分析与代码获取-不用写任何代码/" rel="prev" title="微信短链接秒进支付宝拆红包的逆向分析与代码获取(不用写任何代码)">
                微信短链接秒进支付宝拆红包的逆向分析与代码获取(不用写任何代码) <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="wangxc">
            
              <p class="site-author-name" itemprop="name">wangxc</p>
              <p class="site-description motion-element" itemprop="description">革命尚未成功，同志还需努力~</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">83</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">6</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">124</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/vector4wang" target="_blank" title="GitHub" rel="external nofollow"><i class="fa fa-fw fa-github"></i>GitHub</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="mailto:vector4wang@qq.com" target="_blank" title="E-Mail" rel="external nofollow"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.jianshu.com/u/223a1314e818" target="_blank" title="简书" rel="external nofollow"><i class="fa fa-fw fa-book"></i>简书</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="http://blog.csdn.net/qqhjqs?viewmode=contents" target="_blank" title="CSDN" rel="external nofollow"><i class="fa fa-fw fa-crosshairs"></i>CSDN</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://twitter.com/BMHJQS" target="_blank" title="Twitter" rel="external nofollow"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.facebook.com/" target="_blank" title="FB Page" rel="external nofollow"><i class="fa fa-fw fa-facebook-official"></i>FB Page</a>
                  
                </span>
              
            </div>
          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#登录"><span class="nav-number">1.</span> <span class="nav-text">登录</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#抓取数据"><span class="nav-number">2.</span> <span class="nav-text">抓取数据</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#总结"><span class="nav-number">3.</span> <span class="nav-text">总结</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">wangxc</span>

  

  
</div>


  


<div class="powered-by">
<i class="fa fa-user-md"></i><span id="busuanzi_container_site_pv">
  本站访客数:<span id="busuanzi_value_site_uv"></span>
</span>
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" rel="external nofollow" href="https://hexo.io">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" rel="external nofollow" href="https://theme-next.org">NexT.Mist</a> v6.3.0</div>




        








        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.3.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.3.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.3.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.3.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.3.0"></script>



  



	





  





  








  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  
  
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(function (item) {
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: false,
        notify: false,
        appId: 'YdGFHBfuDwObik8qwCeRAWgr-gzGzoHsz',
        appKey: 'oFpbJwmMQf98DfFDUlzE5Fai',
        placeholder: 'Just go go',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  





  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
